<template>
	<view class="go-top" @click="go">
		<text>回到顶部</text>
	</view>
</template>

<script>
	export default {
		name:"goTop",
		data() {
			return {
				
			};
		},
		methods: {
			go(){
				uni.pageScrollTo({
					duration: 100,
					scrollTop: 0
				})
			}
		}
	}
</script>

<style scoped  lang="scss">
.go-top {
	//固定定位到页面右下角
	position: fixed;
	right: 20rpx;		//rpx：响应式像素数
	bottom: 180rpx;
	width: 110rpx;
	height: 110rpx;
	background-color: #fff;
	border: 1px solid #aaa;
	border-radius: 50%;
	text-align: center;
	opacity: .5;
	font-size: 38rpx;
	&:active {			//SCSS中的&表示“当前元素”
		opacity: 1;
	}
}	
</style>